package cn.tedu.imop.basic.controller;

import cn.tedu.imop.api.model.RestResult;
import cn.tedu.imop.api.model.RestResultUtils;
import cn.tedu.imop.basic.entity.Store;
import cn.tedu.imop.basic.service.StoreService;
import cn.tedu.imop.common.constants.Constants;
import cn.tedu.imop.common.pojo.PageData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "店铺管理")
@RestController
@RequestMapping(Constants.CONTROLLER_API_VERSION+"/store")
public class StoreController {
    private StoreService storeService;
    public StoreController(StoreService storeService) {
        this.storeService = storeService;
    }
    @ApiOperation("查询店铺")
    @GetMapping
    public RestResult<PageData<Store>> getStoreList(Store store){
        return RestResultUtils.success(storeService.getStoreList(store));
    }
    @ApiOperation("创建店铺")
    @PostMapping
    public RestResult createStore(Store store){
          storeService.createStore(store);
          return RestResultUtils.success();
    }
}
